const app = getApp();

// 获取token
export const getTokenCreate = (appInstance = app, code) =>
  appInstance.post("/account/code_login/", { code }, true);

/**
 * @description: 判断是否登录
 */
export const getCheckLogin = (appInstance = app) =>
  appInstance.post("/account/check_login/", true);

// 绑定手机号
export const bindMobile = (appInstance, data) =>
  appInstance.post("/account/bind_mobile/", data, true);

// 获取个人信息
export const getUserInfo = (appInstance = app) =>
  appInstance.get("/account/user_info/", {}, true);

// 注册
export const applyGuide = (data) => app.post("/guide/apply/", data, true);

/**
 * @description: 获取验证码
 */
export const getMobileCode = (appInstance = app, data) =>
  appInstance.post("/common/send_sms/", data, true);

/**
 * @description: 手机号验证码登录
 */
export const bindCustomMobile = (appInstance = app, data) =>
  appInstance.post("/account/bind_custom_mobile/", data, true);

/**
 * @description: 保存用户信息
 */
export const saveUserInfo = (appInstance = app, data) => {
  console.log("app", appInstance);

  return appInstance.put("/account/save_user_info/", data, true);
};

/**
 * @description: 退出登录
 */
export const logout = (appInstance = app) =>
  appInstance.post("/account/logout/", true);
